#ifndef __SINGLETON_H__
#define __SINGLETON_H__

template<class T>
class CSingleTon
{
public:
	static T* Instance() 
	{
		return mInstance;
	}
	static void StaticInit()
	{
		if(!mInstance)
			mInstance=new T();
	}
	static void StaticDestroy()
	{
		if(mInstance)
		{
			delete mInstance;
			mInstance=0;
		}
	}
protected:
	static T* mInstance;
};

template<class T> T* CSingleTon<T>::mInstance=0;

#endif